package daobeauty.interceptor.invoke.impl;

import java.lang.reflect.Method;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import daobeauty.interceptor.invoke.InvokeStrategy;

public class TargetObjectInvoke implements InvokeStrategy {
	private static final Log LOG = LogFactory.getLog(TargetObjectInvoke.class);
	private final Object target;
	private final Method targetMethod;
	
	public TargetObjectInvoke(Object target, Method targetMethod) {
		super();
		this.target = target;
		this.targetMethod = targetMethod;
	}

	public Object invoke(String methodName, Object[] args) throws Exception{
		if (LOG.isDebugEnabled()){
			LOG.debug("found method on target");
		}
		return targetMethod.invoke(target, args);
	}
}
